﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

namespace WandaSolution.HotelInfo
{
    public partial class HotelInfoUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Url.ToString().ToLower().Contains(@"/en/"))
                {
                    tel.InnerText = "Tel";
                    fax.InnerText = "Fax";
                    mail.InnerText = "Mail";
                    address.InnerText = "Address";
                    check.InnerText = "Check in / Check out";
                    pay.InnerText = "Mode of payment";
                }
                
                using (SPWeb spw = SPContext.Current.Web)                
                {
                    SPList spl = spw.Lists["酒店基本信息管理"];

                    if (spl.ItemCount > 0)
                    {
                        SPListItem item = spl.Items[0];
                        lblPhone.Text = item["电话"].ToString();
                        lblFax.Text = item["传真"].ToString();
                        lblEmail.Text = item["电邮"].ToString();
                        lblAddress.Text = item["地点"].ToString();
                        //lblZipcode.Text = item["邮政编码"].ToString();
                        lblInout.Text = item["入住 / 退房"].ToString();
                        lblPaymentTerm.Text = item["付款方式"].ToString();
                        //lblUsefulInfo.Text = item["实用讯息"].ToString();
                    }
                }               
            }
        }
    }
}
